﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using socialnexus.classes.pages;
using socialnexus.classes.models;

namespace socialnexus.admin.EntryPoints
{
    public partial class Edit : ProtectedPage
    {
        socialnexus.classes.models.EntryPoint ep;
        protected void Page_Load(object sender, EventArgs e)
        {
            ep = socialnexus.classes.models.EntryPoint.GetById(Request.QueryString["EntryPointId"].ToString());
            if (!IsPostBack)
            {
                txtName.Text = ep.Name;
                txtDescription.Text = ep.Description;
                txtGUID.Text = ep.GUID;
            }
        }

        protected void btnSubmit_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (Page.IsValid)
            {
                ep.Name = txtName.Text;
                ep.Description = txtDescription.Text;
                ep.GUID = txtGUID.Text;
                ep.Update();

                Response.Redirect("~/admin/EntryPoints/");
                Response.Close();
            }
        }
    }
}
